package com.yaodian100.ec.rank.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

public class ReportProductClickPrimaryKey implements Serializable {

	private static final long serialVersionUID = 1L;

	@Temporal(TemporalType.DATE)
	@Column(name = "COMPUTE_DATE")
	private Date computeDate;
	
	@Column(name = "CATEGORY_ID")
	private Long categoryId;
	
	@Column(name = "PRODUCT_ID")
	private String productId;

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof ReportProductClickPrimaryKey)) {
			return false;
		}
		ReportProductClickPrimaryKey otherObj = (ReportProductClickPrimaryKey) obj;
		
		Date selfComputeDate = this.getComputeDate();
		Long selfCategoryId = this.getCategoryId();
		String selfProductId = this.getProductId();
		
		Date otherComputeDate = otherObj.getComputeDate();
		Long otherCategoryId = otherObj.getCategoryId();
		String otherProductId = otherObj.getProductId();
		
		return new EqualsBuilder().append(selfComputeDate, otherComputeDate).append(selfCategoryId, otherCategoryId).append(selfProductId, otherProductId).isEquals();
	}
	@Override
	public int hashCode() {
		Date selfComputeDate = this.getComputeDate();
		Long selfCategoryId = this.getCategoryId();
		String selfProductId = this.getProductId();
		
		return new HashCodeBuilder().append(selfComputeDate).append(selfCategoryId).append(selfProductId).toHashCode();
	}
	
	//========== getters & setters ==========
	
	public Date getComputeDate() {
		return this.computeDate;
	}
	public void setComputeDate(Date computeDate) {
		this.computeDate = computeDate;
	}

	public Long getCategoryId() {
		return this.categoryId;
	}
	public void setCategoryId(Long categoryId) {
		this.categoryId = categoryId;
	}

	public String getProductId() {
		return this.productId;
	}
	public void setProductId(String productId) {
		this.productId = productId;
	}

}
